const qs = require("querystring");

const str = "abc=hello&qwe=world&tel=12324568790";

const obj = qs.parse(str);
const obj2 = myparse(str);
console.log(obj);
console.log(obj2);

function myparse(str){
    const o = {};
    str.split("&").forEach(val=>{
        o[val.split("=")[0]] = val.split("=")[1]
    })
    return o;
}

console.log( qs.stringify(obj) );
console.log( mystringify(obj) );

function mystringify(obj){
    let str = "";
    for(let i in obj){
        str += `${i}=${obj[i]}&`
    }
    return str.slice(0,-1)
}

// 将中文及符号转码
const s = "中文hello中文@";
console.log(qs.escape(s));

// 解码
const uns = "%E4%B8%AD%E6%96%87hello%E4%B8%AD%E6%96"
console.log(qs.unescape(uns));
